<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8"%>
<!doctype html>

<html class="no-js">

<head>
<%@ include file="../commoms/link.txt"%>
<meta name="description" content="JobWorking">
<script src="assets/js/pagejs/JobWorking.js"></script>
<style type="text/css">
.am-tabs-nav li {
    position: relative;
    z-index: 1;
  }

  .am-tabs-nav .am-icon-close {
    position: absolute;
    top: 0;
    right: 10px;
    color: #888;
    cursor: pointer;
    z-index: 100;
  }

  .am-tabs-nav .am-icon-close:hover {
    color: #333;
  }

  .am-tabs-nav .am-icon-close ~ a {
    padding-right: 25px!important;
  }
</style>

</head>

<body>
	<%@ include file="../commoms/ERHeader.txt"%>

   <div class="admin-content" >
    <div class="admin-content-body" >
    
    
    
    
    
    
    
    
    <div class="am-tabs" data-am-tabs="{noSwipe: 1}" id="doc-tab-demo-1" >
  <ul class="am-tabs-nav am-nav am-nav-tabs" id="ops">
    <li class="am-active"><a href="javascript: void(0)" class="tabdiff" id="tabdiff0">未结束报名</a></li>
    <li><a href="javascript: void(0)" class="tabdiff" id="tabdiff1">已结束报名</a></li>
  </ul>

  <div class="am-tabs-bd" >
    <div class="am-tab-panel am-active" id="tab0" style="height:100%">
    
      <hr>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
     <button type="button" class="am-btn am-btn-default" id="add"><span class="am-icon-plus"></span>新增</button>
              <button type="button" class="am-btn am-btn-default" id="batchend"><span class="am-icon-trash-o"></span> 结束报名</button>
            </div>
          </div>
        </div>
        
      
      </div>
        <div class="am-g">
        <div class="am-u-sm-12">
          
            <table class="am-table am-table-striped am-table-hover table-main">
              <thead>
              <tr>
                <th class="table-check"><input type="checkbox"  id="checkall" />
                </th><th class="table-id">ID</th><th class="table-title">工作名</th><th class="table-author am-hide-sm-only">工作待遇</th><th class="table-author am-hide-sm-only">工作类型</th><th class="table-date am-hide-sm-only">工作时间</th><th class="table-date am-hide-sm-only">发布时间</th><th class="table-set">操作</th>
              </tr>
              </thead>
							
					<tbody id="pagecontainer0">

					</tbody>
				</table>
			    <div class="am-cf" id="num">
              
            </div>
            <div class="am-fr">
			  <ul id="page0" data-am-widget="pagination"
				class="am-pagination am-pagination-default">
			  </ul>
              </div>
          
        </div>

      </div>
    </div>
    <div class="am-tab-panel" id="tab1">
    
      <hr>

  
        <div class="am-g">
        <div class="am-u-sm-12">
          
            <table class="am-table am-table-striped am-table-hover table-main">
              <thead>
              <tr>
              <th class="table-id">ID</th><th class="table-title">工作名</th><th class="table-author am-hide-sm-only">工作待遇</th><th class="table-author am-hide-sm-only">工作类型</th><th class="table-date am-hide-sm-only">工作时间</th><th class="table-date am-hide-sm-only">发布时间</th><th class="table-set">操作</th>
              </tr>
              </thead>
							
					<tbody id="pagecontainer1">

					</tbody>
				</table>
			    <div class="am-cf" id="num1">
              
            </div>
            <div class="am-fr">
			  <ul id="page1" data-am-widget="pagination"
				class="am-pagination am-pagination-default">
			  </ul>
              </div>
          
        </div>

      </div>
    </div>
   
  </div>
</div>
    
    </div>

  </div>
  <%@ include file="../commoms/alert.txt"%>
</div>
	<script type="text/javascript">
		var currentpage = 1;
		var pages = 1;
		var ldata = null;
         var nums=0;
         var allnums=null;
         var $ul = $('#page0');
 		var $pagecontainer = $('#pagecontainer0');
 		var currenttab = 1;
 		var status = 28;
 		
 		
 		
	myAjax(domain + "/getAllERCount.do", {}, function(
				data) {
		      allnums=data;
			$('#count1').text(data.nostart);
			$('#count2').text(data.started+data.end);
			$('#count3').text(data.finish);
			changetabs(0);
		});
		$('#ops').on('click', '.tabdiff', function(event) {
			var temp = event.currentTarget.id.replace("tabdiff", "");
			changetabs(temp);

		});
	
 		

		function init() {
	           if(allnums!=null)
	        	   {
	        	   if(status==28)
	        		   nums=allnums.started;
	        	   if(status==40)
	        		   nums=allnums.end;
	        	   $('#num').text('共'+nums+'条记录');
					pages = Math.ceil(pages / 5)
					if (nums!= 0) {
						drawPages($ul, currentpage, pages, 10);
						getdiffstatuscontent(domain + '/getDiffStatusPtJob.do', {
							'page' : currentpage,
							'status' : status
						}, $pagecontainer);
					}
					$pagecontainer.on('click', '.pay', function(event) {
						further('pay', event.currentTarget.id)
					});
					$pagecontainer.on('click', '.cancel', function(event) {
						further('cancel', event.currentTarget.id)
					});
					$pagecontainer.on('click', '.ReqManager', function(event) {
					
						further('ReqManager', event.currentTarget.id)
					});
					$pagecontainer.on('click','.ptjob',function(event){
					var pid=event.currentTarget.id;
					 var index=pid.replace('ptjob',"");
					if(event.target.nodeName!='BUTTON'&&event.target.nodeName!='INPUT')
						{
					myPost('/showItemDetail.do',{'ptid':ldata[index].id}); 
						}
				});
	        	   }
	

		}
		
		
		$("#checkall").change(function() { 
			if($("#checkall").prop('checked'))
			     $(".check").prop("checked","checked");
				else
					$(".check").prop("checked",false);
		
		}); 
		$pagecontainer.on('click', '.check', function(event) {
			
			if (!$('#'+event.currentTarget.id).is(':checked'))
				$("#checkall").prop("checked", false);
		});
		$("#add").click(function() {
			window.location.href = "/Job-Posted.jsp";

		});
		
		$("#batchend").click(function() {
			var id = '?';
			$.each(ldata, function(i, item) {
				if ($('#check' + i).is(':checked'))
					id += 'id=' + item.id+'&';
			});

			if (id != '?') {
				id=id.substring(0,id.length-1);
				myAjax('/batching/end.do'+id, {}, function(data) {
                  if(data.state=='success')
                	  myAlert('提示','操作成功');
                  window.location.href='/JobWorking.jsp';
				});
			}
			else
				myAlert('提示','请选择操作的工作');
		});
	
	 
	</script>

	<a href="#"
		class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu"
		data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
</body>
</html>